<template>
  <div id="teamInformation">
    <el-descriptions class="margin-top" title="我的团队" :column="1" size="medium">
      <template slot="extra">
        <el-button type="primary" size="small">解散队伍</el-button>
      </template>
      <el-descriptions-item label="队伍名称">{{TI_teamName}}</el-descriptions-item>
      <el-descriptions-item label="队伍简介">{{TI_teamContent}}</el-descriptions-item>
      <el-descriptions-item label="指导老师">{{TI_teacher}}</el-descriptions-item>
      <el-descriptions-item label="队长">{{TI_captain}}</el-descriptions-item>
      <el-descriptions-item label="队员1">{{TI_student1}}</el-descriptions-item>
      <el-descriptions-item label="队员2">{{TI_student2}}</el-descriptions-item>
      <el-descriptions-item label="竞赛科目">
        <el-tag size="small">{{TI_subject}}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="成立时间">{{TI_createTime}}</el-descriptions-item>
    </el-descriptions>

  </div>
</template>

<script>
  import Axios from "axios";
  import jwtDecode from 'jwt-decode'

  const instance = Axios.create({
    baseURL: 'http://localhost:8081/api/pri/team',
    timeout: 5000,
  })


    export default {
        name: "teamInformation",
        created() {
          this.findTeamInformation(this.teamId);
        },
      data(){
          return{
            teamId: this.$store.state.all_teamId,
            TI_teamName:'',
            TI_teamContent:'',
            TI_teacher:'',
            TI_captain:'',
            TI_student1:'',
            TI_student2:'',
            TI_subject:'未报名竞赛',
            TI_createTime:''

          }
        },
        methods:{
          findTeamInformation(teamId){
            instance.post('finTeamByTeamId',teamId)
              .then(res=>{
                const teamInfo = res.data.data;
                //把接收到的值赋值给上面的data中的各个属性
                this.TI_teamName = teamInfo.teamName;
                this.TI_teamContent = teamInfo.teamContent;
                this.TI_teacher = teamInfo.teacher.name;
                this.TI_captain = teamInfo.captain.name;
                this.TI_student1 = teamInfo.player[0].name;
                this.TI_student2 = teamInfo.player[1].name;
                this.TI_createTime = teamInfo.createTime;
              })
          }
        }

    }
</script>

<style scoped>

</style>
